<template>
  <div class="add-brand">
      <div class="container">
        <div class="model-title">品牌新增</div>
        <!-- 表单 -->
        <div class="form-box">
           <el-form ref="brandForm" :model="brandForm" label-width="100px">
              <el-form-item label="品牌名称">
                <el-input placeholder="请输入品牌名称" v-model="brandForm.name"></el-input>
              </el-form-item>
              <el-form-item label="管理员手机">
                <el-input placeholder="请输入管理员手机号" v-model="brandForm.phone"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button type="danger" size="medium" style="width:200px" @click="addBrand">点击添加</el-button>
              </el-form-item>
           </el-form>
        </div>
      </div>
  </div>
</template>

<script>
export default {
  name:'add-brand',
  data () {
    return {
        brandForm:{
          name:'',
          phone:""
        }
    };
  },
  components: {},
  created() {},
  mounted() {},
  methods: {
    addBrand(){
      // 提交信息
      if(this.brandForm.name===null||this.brandForm.name===""){
        this.$message.error("请输入品牌名称！")
        return;
      }
      if(this.brandForm.phone===null||this.brandForm.phone===""){
        this.$message.error("请输入管理员手机！")
        return;
      }
      let url = `user/brand/add`,
          params = `name=${this.brandForm.name}&manager_phone=${this.brandForm.phone}&copy_brandid=2&coin_ratio=1.00&auto_upgrade=1`;
      this.$Http.post(url,params).then(res=>{
        if(res.data.resp_code === "000000"){
           // 添加成功
        }
        this.$notify.info({
            title: '提示',
            message: res.data.resp_message
        });
      }).catch(err=>{
         this.$notify.error({
            title: '提示',
            message: "添加品牌信息失败！"
        });
      })
    }
  }
}

</script>
<style scoped>
.add-brand{
  box-sizing: border-box;
  padding: 20x;
}
.form-box{
  padding: 20px 10px;
  max-width: 600px;
}
</style>